package me.ingxin.android.badge

import androidx.annotation.ColorInt

/**
 * Created by ingxin on 2022/12/21
 */
@Suppress("UNCHECKED_CAST")
abstract class BadgeBuilder<T> {

    protected val badgeDrawable = BadgeDrawable()
    protected var gravity = Badge.Gravity.TopEnd

    /**
     * 设置背景颜色
     */
    fun setBackgroundColor(@ColorInt color: Int): T {
        badgeDrawable.backgroundColor = color
        return this as T
    }

    /**
     * 设置边框宽度
     */
    fun setBorderWidth(width: Int): T {
        badgeDrawable.borderWidth = width
        return this as T
    }

    /**
     * 设置边框颜色
     */
    fun setBorderColor(@ColorInt color: Int): T {
        badgeDrawable.borderColor = color
        return this as T
    }

    /**
     * 设置角标位置
     */
    fun setGravity(gravity: Badge.Gravity): T {
        this.gravity = gravity
        return this as T
    }

}